#include "PSFActionInitialization.hh"

#include "PSFDetectorConstruction.hh"
#include "PSFEventAction.hh"
#include "PSFPrimaryGeneratorAction.hh"
#include "PSFRunAction.hh"
#include "PSFStackingAction.hh"
#include "PSFSteppingAction.hh"
#include "PSFTrackingAction.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PSFActionInitialization::PSFActionInitialization(PSFDetectorConstruction *det)
    : G4VUserActionInitialization(), fDetector(det)
{
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PSFActionInitialization::BuildForMaster() const
{
  auto eventAction = new PSFEventAction;
  SetUserAction(new PSFRunAction(eventAction));
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PSFActionInitialization::Build() const
{
  SetUserAction(new PSFPrimaryGeneratorAction(fDetector));

  auto eventAction = new PSFEventAction;
  SetUserAction(eventAction);

  SetUserAction(new PSFRunAction(eventAction));

  SetUserAction(new PSFTrackingAction());
  SetUserAction(new PSFSteppingAction(fDetector, eventAction));
  SetUserAction(new PSFStackingAction());
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
